package com.dt76.smallloanbackendservice.controller.xiaohao;

import com.dt76.smallloanbackendservice.pojo.xiaohao.ApprovalLoan;
import com.dt76.smallloanbackendservice.pojo.xiaohao.BorrowOrder;
import com.dt76.smallloanbackendservice.pojo.xiaohao.BorrowOrderQuery;
import com.dt76.smallloanbackendservice.service.xiaohao.ApprovalLoanService;
import com.dt76.smallloanbackendservice.utils.Page;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

@Controller
@RequestMapping("/xiaohao")
public class ApprovalLoanController {

    @Resource
    private ApprovalLoanService approvalLoanService;

    @PostMapping("/ApprovalLoan/addApproveLoan")
    @ResponseBody
    public int addApproveLoan(@RequestBody ApprovalLoan approvalLoan) {
        return approvalLoanService.insertApproveLoan(approvalLoan);
    }

    @PostMapping("/ApprovalLoan/qryAllLoanOrder")
    @ResponseBody
    public Page qryAllLoanOrder(Integer currentPageNo, @RequestBody BorrowOrderQuery borrowOrderQuery) {
        System.out.println(borrowOrderQuery.toString());
        return approvalLoanService.qryAllLoanOrder(currentPageNo, borrowOrderQuery);
    }

    @PostMapping("/ApprovalLoan/qryAllHanderOrder")
    @ResponseBody
    public Page qryAllHanderOrder(Integer currentPageNo, @RequestBody BorrowOrderQuery borrowOrderQuery) {
        System.out.println(borrowOrderQuery.toString());
        return approvalLoanService.qryAllHanderOrder(currentPageNo, borrowOrderQuery);
    }
}
